package com.extrace.map;

import android.content.Intent;
import android.os.Bundle;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.extrace.loader.PackageRouteLoader;

public class SaveLocation extends AppCompatActivity {

    private PackageRouteLoader mLoader;
    private Intent mIntent;
    private double x=0, y=0;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        mIntent = getIntent();
        if(mIntent.hasExtra("x") && mIntent.hasExtra("y")) {
            x = mIntent.getDoubleExtra("x", 0);
            y = mIntent.getDoubleExtra("y", 0);
            SaveRoute(x, y);
        }
        finish();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();

    }

    public void SaveRoute(double x, double y) {
        try {
            mLoader = new PackageRouteLoader(this);
            mLoader.SaveRoute(x, y);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
